<?php
/**
 * Sample of Controller
 */ 
class AzendController extends Zend_Controller_Action{ 
 
    /**
     * @var Zend_View_Wrapper_Smarty 
     */ 
    public $view;
	protected $title;
	
	function init()
	{
		$this->_helper->viewRenderer->setNoRender(); 
		$this->view = new Smarty_View(); 
		$this->view->assign("base_url", $this->_request->getBaseUrl()); 
	}
	
    public function indexAction()
	{
		$this->title = "Get data from database then display on the page.";
		Zend_Loader::loadClass('Test');
		
		$test = new Test(); 
		
		$all_data = $test->getData();
		
		$this->view->assign("title", $this->title);
		
		$this->view->assign("all_data", $all_data);
    	
		$this->view->render('index.html');
    }
    public function addAction()
	{   
		
	    $this->title = "Cap nhat 1 sach moi";
		$this->view->assign("title", $this->title);
		Zend_Loader::loadClass('Test');
		if ($this->_request->isPost()) {
            Zend_Loader::loadClass('Zend_Filter_StripTags');
            $filter = new Zend_Filter_StripTags();
            
        	$name= $filter->filter($this->_request->getPost(''));
        	$name = trim($name);
        	$author = trim($filter->filter($this->_request->getPost('author')));
        	$description= trim($filter->filter($this->_request->getPost('description')));
		}
		echo "aloha";
    $this->view->render('add.html');
    
	}
}

?>